
package com.app.hmst.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.codehaus.jackson.annotate.JsonProperty;

import com.roscopeco.ormdroid.Entity;

public class IndicatorResultVO extends Entity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 488849817562019369L;
	public int id;
   	public String subCategoryId;
   	public String categoryId;
   	public String homeId;
   	public String result;
   	public String image;
   	public String comment_img;
   	public String comment_text;
   	public String houseId;
   	public String indicatorId;
   	public String img1;
 	public String img2;
 	public String img3;
 	
   	public IndicatorResultVO(){
   		this(null, null, null, null, null, null, null, null, null, null, null, null);
   	}


	public IndicatorResultVO(String subCategoryId, String categoryId,
			String homeId, String result, String image, String comment_img,String comment_text,String houseId,String indicatorId,String img1,String img2,String img3) {
		this.subCategoryId = subCategoryId;
		this.categoryId = categoryId;
		this.homeId = homeId;
		this.result = result;
		this.image = image;
		this.comment_img = comment_img;
		this.comment_text = comment_text;
		this.houseId = houseId;
		this.indicatorId = indicatorId;
		this.img1 = img1;
		this.img2 = img2;
		this.img3 = img3;
	}
	public List<IndicatorResultVO> getByhomeId(String homeSId) {
		List<IndicatorResultVO> list = query(IndicatorResultVO.class).where("homeId").eq(homeSId).executeMulti();
		List<IndicatorResultVO> indList = new ArrayList<IndicatorResultVO>();
		if(list!=null && list.size()>0){
			for(IndicatorResultVO ind : list){
				if("0".equals(ind.houseId)){
					indList.add(ind);
				}
			}
		}
		return indList;
	}
	public int getPk(){
		List<IndicatorResultVO> list = null;
		int key = 1;
		list = query(IndicatorResultVO.class).executeMulti();
		if(list!=null && !list.isEmpty()){
			key = list.size()+1;
		}
		return key;
		
	}
   	public List<String> getImgList(IndicatorResultVO indicatorResultVO){
   		List<String> imgList = new ArrayList<String>();
   		if(indicatorResultVO!=null){
   			if(indicatorResultVO.img1 !=null && !"".equals(indicatorResultVO.img1)){
   				imgList.add(indicatorResultVO.img1);
   			}
   			if(indicatorResultVO.img2 !=null && !"".equals(indicatorResultVO.img2)){
   				imgList.add(indicatorResultVO.img2);
   			}
   			if(indicatorResultVO.img3 !=null && !"".equals(indicatorResultVO.img3)){
   				imgList.add(indicatorResultVO.img3);
   			}
   		}
   		return imgList;
   	}
	
   	
   	
}
